import requests,json
import pandas as pd
zhang_key = "241cb34c3ba21b934c74a65177c504ec"


def geocode(zhang_key,address,city=None):
    url = 'https://restapi.amap.com/v3/geocode/geo?parameters'
    params={
        'key': zhang_key,
        'address':address,
        'city':city
    }
    response = requests.get(url,params=params)
    results = response.json()['geocodes'][0]['location']
    return results



def around(zhang_key,location,keywords=None,types=None,radius=None,offset=None,page=None,extensions='base'):
    url="https://restapi.amap.com/v3/place/around?parameters"
    params={
        "key":zhang_key,
        "location":location,
        "keywords":keywords,
        "types":types,
        "radius":radius,
        "offset":offset,
        "page":page,
        "extensions":extensions
    }
    r=requests.get(url,params=params)
    results=r.json()
    return results
